<?php
if (!defined('IN_CRONLITE')) exit();
$conf['dlhtkt'] = $conf['dlhtkt'] ?? 0;
if ($conf['dlhtkt'] == 1) {
	if ($islogin2 == 1) {
	} else exit('<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>温馨提示</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="shortcut icon" href="/favicon.ico" />
	<style type="text/css">
		*{box-sizing:border-box;margin:0;padding:0;font-family:Lantinghei SC,Open Sans,Arial,Hiragino Sans GB,Microsoft YaHei,"微软雅黑",STHeiti,WenQuanYi Micro Hei,SimSun,sans-serif;-webkit-font-smoothing:antialiased}
		body{padding:70px 0;background:#edf1f4;font-weight:400;font-size:1pc;-webkit-text-size-adjust:none;color:#333}
		a{outline:0;color:#3498db;text-decoration:none;cursor:pointer}
		.system-message{margin:20px 5%;padding:40px 20px;background:#fff;box-shadow:1px 1px 1px hsla(0,0%,39%,.1);text-align:center}
		.system-message h1{margin:0;margin-bottom:9pt;color:#444;font-weight:400;font-size:40px}
		.system-message .jump,.system-message .image{margin:20px 0;padding:0;padding:10px 0;font-weight:400}
		.system-message .jump{font-size:14px}
		.system-message .jump a{color:#333}
		.system-message p{font-size:9pt;line-height:20px}
		.system-message .btn{display:inline-block;margin-right:10px;width:138px;height:2pc;border:1px solid #44a0e8;border-radius:30px;color:#44a0e8;text-align:center;font-size:1pc;line-height:2pc;margin-bottom:5px;}
		.success .btn{border-color:#69bf4e;color:#69bf4e}
		.error .btn{border-color:#ff8992;color:#ff8992}
		.info .btn{border-color:#3498db;color:#3498db}
		.copyright p{width:100%;color:#919191;text-align:center;font-size:10px}
		.system-message .btn-grey{border-color:#bbb;color:#bbb}
		.clearfix:after{clear:both;display:block;visibility:hidden;height:0;content:"."}
		@media (max-width:768px){body {padding:20px 0;}}
			@media (max-width:480px){.system-message h1{font-size:30px;}}
	</style>
</head>
<body>
<div class="system-message error">
	<div class="image">
		<img src="./assets/img/error.svg" alt="" width="150" />
	</div>
	<h1>请先登录到用户中心！</h1>
			<p class="jump">
			为了您在后期使用中方便，请您先注册个账号登录用户中心开通你想要的业务！<br>
			1. 价格比前台便宜优惠<br>
			2. 支持自助更换会员域名<br>
			3. 支持自助续费会员域名 等多功能等你来体验～</p>
		<p class="clearfix">
		<a href="/" class="btn btn-grey">返回上一页</a>
		<a id="href" href="./user" class="btn btn-primary">用户中心</a>
			</p>
</div>
</body>
</html>');
}
if ($conf['jzfwjk'] == 1) {
	if ($row) {
		exit("<script language='javascript'>window.location.href='https://ssl.gongyi.qq.com/m/weixin/index2_gzzh.htm?et=fxhmqq';</script>");
	}
}
?>
<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="utf-8">
	<title>自助开通业务 - <?php echo $conf['sitename'] ?></title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	<link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
	<style>
		body {
			background: linear-gradient(to right, #c9c, #ccf);
			font-family: 微软雅黑
		}

		@media only screen and (min-width:700px) {
			.content {
				left: 50%;
				margin-left: -25%
			}
		}

		.img {
			width: 7em;
			height: 7em;
			margin: auto;
			display: block;
			border-radius: 10em;
			box-shadow: 3px 3px 8px 1px silver;
			margin-bottom: 1em
		}

		.imgc {
			background-image: url(https://api.ixiaowai.cn/gqapi/gqapi.php);
			background-size: 100% 100%;
			background-repeat: repeat;
			top: 0;
			position: fixed;
			left: 0;
			width: 100%;
			height: 100%;
			z-index: -33
		}

		.layui-layer-title {
			background-color: #000 !important;
			color: white !important;
		}

		#qrimg {
			margin-bottom: 2em;
		}
	</style>
</head>

<body layadmin-themealias="dark-blue" style="margin-top: 1em;">
	<div class="imgc">
	</div>
	<div class="layui-fluid">
		<div class="layui-row layui-col-space15">
			<div class="layui-col-md12 layui-col-sm12">
				<div class="layui-card">
					<div class="layui-card-header">自助开通业务权限</div>
					<div class="layui-card-body">
						<div class="layui-tab" lay-filter="test">
							<ul class="layui-tab-title">
								<li class="layui-this" lay-id="11">开通会员</li>
								<li onclick="cxhy()">查询会员</li>
							</ul>
							<div class="layui-tab-content">
								<div class="layui-tab-item layui-show">
									<blockquote class="layui-elem-quote">
										<font color="red" size="3"><?php echo $conf['ktymgg'] ?? '' ?><?php if (isset($conf['fhyyum']) && $conf['fhyyum'] == 2) { ?>
											<hr>本站已开启泛域名开通，直接添加一级域名即可哟！<?php } ?>
										</font>
									</blockquote>
									<div class="layui-form layui-form-pane">
										<div class="layui-form-item">
											<label class="layui-form-label"><i class="layui-icon layui-icon-cart-simple"></i>商品名称</label>
											<div class="layui-input-block">
												<input type="text" name="name" value="<?php echo $conf['spmc'] ?>" class="layui-input " onclick="layer.tips('此功能不可修改', this, {tips: 1});" readonly="readonly">
											</div>
										</div>
										<div class="layui-form layui-form-pane">
											<div class="layui-form-item">
												<label class="layui-form-label"><i class="layui-icon layui-icon-fire"></i>订单号</label>
												<div class="layui-input-block">
													<input type="text" name="trade_no" value="<?php echo date("YmdHis") . rand(100000, 999999); ?>" class="layui-input" onclick="layer.tips('此功能不可修改', this, {tips: 1});" readonly="readonly">
												</div>
											</div>
											<?php
											if (!empty($conf['viphy']) or !empty($conf['viphy2']) or !empty($conf['viphy3']) or !empty($conf['viphy4']) or !empty($conf['viphy5'])) { ?>
												<div class="layui-form layui-form-pane">
													<div class="layui-form-item">
														<label class="layui-form-label"><i class="layui-icon layui-icon-rmb"></i>开通时间</label>
														<div class="layui-input-block">
															<select name="ktrq" lay-filter="aihao">
																<?php if (!empty($conf['viphy5'])) { ?><option value="5">1天 - <?php echo $conf['viphy5'] ?> ￥</option><?php } ?>
																<?php if (!empty($conf['viphy2'])) { ?><option value="1">30天 - <?php echo $conf['viphy2'] ?> ￥</option><?php } ?>
																<?php if (!empty($conf['viphy3'])) { ?><option value="2">90天 - <?php echo $conf['viphy3'] ?> ￥</option><?php } ?>
																<?php if (!empty($conf['viphy4'])) { ?><option value="3">365天 - <?php echo $conf['viphy4'] ?> ￥</option><?php } ?>
																<?php if (!empty($conf['viphy'])) { ?><option value="4">永久使用 - <?php echo $conf['viphy'] ?> ￥</option><?php } ?>
															</select>
														</div>
													</div>
												<?php } ?>
												<div class="layui-form layui-form-pane">
													<div class="layui-form-item">
														<label class="layui-form-label"><i class="layui-icon layui-icon-website"></i>开通域名</label>
														<div class="layui-input-block">
															<input type="text" name="domain" placeholder="请输入要开通的域名" class="layui-input" required>
														</div>
													</div>
													<div class="layui-form layui-form-pane">
														<div class="layui-form-item">
															<label class="layui-form-label"><i class="layui-icon layui-icon-login-qq"></i>开通QQ</label>
															<div class="layui-input-block">
																<input type="text" name="qq" placeholder="请输入正确QQ,可验证更换域名" class="layui-input" required>
															</div>
														</div>
														<?php if (isset($conf['captcha_open']) && $conf['captcha_open'] == 1 && $conf['ywgmyz'] == 1 && $conf['viphy'] == 0 && $conf['viphy2'] == 0 && $conf['viphy3'] == 0 && $conf['viphy4'] == 0 && $conf['viphy5'] == 0) { ?>
															<center>
																<div id="embed-captcha">
																	<p id="wait"></p>
																</div>
															</center><br />
														<?php } ?>
														<center>
															<div class="layui-form-item">
																<div class="layui-input-company">
																	<?php if ($conf['viphy'] == 0 && $conf['viphy2'] == 0 && $conf['viphy3'] == 0 && $conf['viphy4'] == 0 && $conf['viphy5'] == 0) { ?>
																		<input type="button" id="submit_vip" onclick="submit_vip()" value="免费领取1个月" class="layui-btn layui-btn-fluid qint_color">
																	<?php } else { ?>
																		<input type="button" id="submit_vip" onclick="submit_vip()" value="立即开通" class="layui-btn layui-btn-fluid qint_color">
																	<?php } ?>
																</div>
															</div>
													</div>
												</div>
												</div>
										</div>
									</div>
									<hr>
									<div class="form-group">
										<a href="javascript:void(0);" onclick="lxkf()" class="btn btn-info btn-rounded"><i class="fa fa-unlock"></i> 联系客服</a>

										<a href="../" class="btn btn-primary btn-rounded" style="float:right;"><i class="fa fa-user"></i> 返回主页</a>
									</div>
								</div>
							</div>
						</div>
					</div>
					</form>
				</div>
			</div>
			</br>
			<div style="color: white;width: 100%;text-align: center;margin-bottom: 2rem;">
				<p>Copyright © 2018-<?= date('Y') ?> <?php echo $conf['sitename'] ?><br>
				</p>
			</div>
			<script src="../assets/layuiadmin/dist/layui.js" charset="utf-8"></script>
			<script src="//lib.baomitu.com//jquery/3.4.1/jquery.min.js"></script>
			<script src="../assets/layuiadmin/layui/layui.all.js"></script>
			<script src="//lib.baomitu.com/layer/2.3/layer.js"></script>
			<script src="<?php echo $cdnpublic ?>layer/3.1.1/layer.js"></script>
			<script src="//static.geetest.com/static/tools/gt.js"></script>
			<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
			<script src="./assets/js/fhmain.js"></script>
			<script src="<?php echo $cdnpublic ?>clipboard.js/1.7.1/clipboard.min.js"></script>
			<script>
				function lxkf() {
					layer.alert('是否需要联系站长,若有任何不懂的地方,可以随时联系他哦~<br>站长QQ:<?php echo $conf['kfqq'] ?>', {
						title: '联系客服',
						icon: '3',
						btn: ['这就联系Ta', '不用了'],
						btn1: function(layero, index) {
							layer.msg('正在跳转聊天窗口!');
							window.open("http://wpa.qq.com/msgrd?v=3&uin=<?php echo $conf['kfqq'] ?>&site=qq&menu=yes", "_blank");
						}
					});
				}
				<?php if (!empty($conf['hyjs'])) { ?>
					layer.alert('<?php if (!$conf['hyjs']) {
										echo '啊哦～站长还未发布介绍文档！';
									} else {
										echo '' . $conf['hyjs'] . '';
									} ?>', {
						title: '会员介绍',
						btn: ['了解'],
					});
				<?php } ?>
				$(document).ready(function() {
					$("#submit_vip").click(function() {
						var domain = $("input[name='domain']").val();
						var qq = $("input[name='qq']").val();
						var ktrq = $("select[name='ktrq']").val();
						var geetest_challenge = $("input[name='geetest_challenge']").val();
						var geetest_validate = $("input[name='geetest_validate']").val();
						var geetest_seccode = $("input[name='geetest_seccode']").val();
						if (domain == '' || qq == '') {
							layer.alert('请确保每个项目不能为空！', {
								icon: 5
							});
							return false;
						}
						var ii = layer.load(2, {
							shade: [0.1, '#fff']
						});
						$.ajax({
							type: "POST",
							url: "ajax.php?act=vippay",
							data: {
								"domain": domain,
								"qq": qq,
								"ktrq": ktrq,
								"geetest_challenge": geetest_challenge,
								"geetest_validate": geetest_validate,
								"geetest_seccode": geetest_seccode
							},
							dataType: 'json',
							success: function(data) {
								layer.close(ii);
								if (data.code == 0) {
									var paymsg = '';
									if (data.pay_alipay > 0) {
										paymsg += '<button class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm" onclick="dopay(\'alipay\',\'' + data.trade_no + '\')" style="margin-top:10px;"><img width="20" src="../assets/icon/alipay.ico" class="logo">支付宝</button>';
									}
									if (data.pay_qqpay > 0) {
										paymsg += '<button class="layui-btn layui-btn-primary layui-border-black layui-btn-sm" onclick="dopay(\'qqpay\',\'' + data.trade_no + '\')" style="margin-top:10px;"><img width="20" src="../assets/icon/qqpay.ico" class="logo">QQ钱包</button>';
									}
									if (data.pay_wxpay > 0) {
										paymsg += '<button class="layui-btn layui-btn-primary layui-btn-sm layui-border-green layui-btn-sm" onclick="dopay(\'wxpay\',\'' + data.trade_no + '\')" style="margin-top:10px;"><img width="20" src="../assets/icon/wechat.ico" class="logo">微信支付</button>';
									}
									if (data.paymsg != null) paymsg += data.paymsg;
									layer.alert('<center><h2>￥ ' + data.money + '</h2><hr>' + paymsg + '<hr><a class="layui-btn layui-btn-fluid layui-btn-sm" onclick="window.location.reload()">取消订单</a></center>', {
										btn: [],
										title: '提交订单成功',
										closeBtn: false
									});
								} else if (data.code == 1) {
									layer.alert(data.msg, {
										icon: 1,
										closeBtn: false
									}, function() {
										window.location.href = "../";
									});
								} else if (data.code == 2) {
									layer.alert(data.msg, {
										icon: 5,
										closeBtn: false
									}, function() {
										window.location.reload();
									});
								} else if (data.code == 3) {
									layer.alert(data.msg, {
										icon: 5,
										closeBtn: false
									});
								} else {
									layer.alert(data.msg);
								}
							}
						});
					});
				});
				var handlerEmbed = function(captchaObj) {
					// 将验证码加到id为captcha的元素里，同时会有三个input的值：geetest_challenge, geetest_validate, geetest_seccode
					captchaObj.appendTo("#embed-captcha");
					captchaObj.onReady(function() {
						$("#wait")[0].className = "hide";
					});
					// 更多接口参考：http://www.geetest.com/install/sections/idx-client-sdk.html
				};
				$.ajax({
					// 获取id，challenge，success（是否启用failback）
					url: "./ajax.php?act=captcha&t=" + (new Date()).getTime(), // 加随机数防止缓存
					type: "get",
					dataType: "json",
					success: function(data) {
						console.log(data);
						// 使用initGeetest接口
						// 参数1：配置参数
						// 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
						initGeetest({
							gt: data.gt,
							https: true,
							width: '100%',
							challenge: data.challenge,
							new_captcha: data.new_captcha,
							product: "popup", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
							offline: !data.success // 表示用户后台检测极验服务器是否宕机，一般不需要关注
							// 更多配置参数请参见：http://www.geetest.com/install/sections/idx-client-sdk.html#config
						}, handlerEmbed);
					}
				});

				function cxhy() {
					layer.prompt({
						title: '输入查询会员域名',
						formType: 0
					}, function(text, index) {
						var index = layer.msg('正在查询中...', {
							icon: 16,
							time: 10 * 1000
						});
						$.ajax({
							type: 'post',
							url: 'ajax.php?act=cxdqsj',
							data: {
								url: text
							},
							dataType: 'json',
							success: function(data) {
								if (data.code == 0) {
									layer.alert('<blockquote class="layui-elem-quote">' + data.msg + '</blockquote>', {
										skin: 'layui-layer-molv',
										shade: [0.8, '#393D49'],
										btn: ['去续费', '关闭'],
										title: '查询结果成功！',
										offset: '120px',
										anim: 1,
										yes: function() {
											window.location.href = "./user";
										}
									})
								} else {
									layer.alert('<blockquote class="layui-elem-quote">' + data.msg + '</blockquote>', {
										skin: 'layui-layer-molv',
										shade: [0.8, '#393D49'],
										btn: ['好的'],
										title: '查询结果失败！',
										offset: '120px',
										anim: 1
									})
								}
								layer.close(index);
							},
							error: function(data) {
								layer.msg('服务器错误');
								return false;
							}
						});
					});
				}
			</script>
</body>

</html>